﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Channel.aspx.cs" Inherits="WebChat.User.Channel" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <asp:Label runat="server" ID="LiteralError" CssClass="errorMessage" />

    <asp:Literal runat="server" ID="LiteralChannelName" />

    <asp:ScriptManager runat="server" ID="ScriptManager" />    
    <asp:UpdatePanel runat="server" ID="UpdatePanelMessages" UpdateMode="Conditional" >
        <%--<Triggers>
            <asp:AsyncPostBackTrigger ControlID="TimerMessages" />
        </Triggers>--%>
        <ContentTemplate>
            <asp:UpdatePanel runat="server" ID="UpdatePanelTimer" UpdateMode="Conditional" >
                <ContentTemplate>
                    <asp:Timer runat="server" ID="TimerMessages" Interval="1000" OnTick="TimerMessages_OnTick" />            
                </ContentTemplate>
            </asp:UpdatePanel>

            <asp:Repeater runat="server" ID="RepeaterMessages" >
                <SeparatorTemplate>
                    ...
                </SeparatorTemplate>
                <ItemTemplate>
                <p>
                    [<asp:HyperLink runat="server" 
                            Text="delete" 
                            NavigateUrl='<%# "ConfirmDeleteChannelMessage.aspx?messageId=" + Eval("MessageId") %>'
                            Visible='<%# EvalSenderChatterIdEqualsCurrentChatterId() %>' />]

                    [<asp:Label runat="server" 
                            Text='<%# ((DateTime)Eval("DateTimeSent")).ToShortTimeString() %>' 
                            ToolTip='<%# ((DateTime)Eval("DateTimeSent")).ToString() %>'  />]
                    [<asp:HyperLink runat="server" 
                            Text='<%# EvalChatterUserName() %>' 
                            NavigateUrl='<%# "Chatter.aspx?chatterId=" + EvalSenderChatterId() %>' />]

                    <asp:Label runat="server" class="message"
                            Text='<%# SafeEval("MessageContent") %>' />
                </p>
                </ItemTemplate>
            </asp:Repeater>                
        </ContentTemplate>
    </asp:UpdatePanel>
    

    <asp:Label runat="server" Text="Message: " AssociatedControlID="TextBoxMessage" />
    <asp:TextBox runat="server" ID="TextBoxMessage" />
    <asp:RequiredFieldValidator runat="server" ControlToValidate="TextBoxMessage" >
        *
    </asp:RequiredFieldValidator>
    <asp:Button runat="server" ID="ButtonSendMessage" OnClick="ButtonSendMessage_OnClick" Text="Send" />
    
</asp:Content>
